﻿@model PagedList<PMSMVC.Models.Project>

@using Webdiyer.WebControls.Mvc 

@{
    ViewBag.Title = "Index";
}

<h2>项目列表</h2>

<p>
    @Html.ActionLink("创建新项目", "Create")
</p>
<table>
    <tr>
        <th>
            项目编号
        </th>
        <th>
            项目名称
        </th>
        <th>
            客户名称
        </th>
        <th>
            录入时间
        </th>
        <th>
            录入人
        </th>
        <th>
            详细
        </th>
        <th>
            增加产品
        </th>
        <th>
            操作
        </th>
        <th>
            确认操作
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink(item.ProjectID, "Index", "DocTask", new { projectID = item.ProjectID }, null)            
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ProjectName)
        </td>
        <td>
            @if (item.ProductTypes.FirstOrDefault() != null)
            {
            @Html.DisplayFor(modelItem => item.ProductTypes.FirstOrDefault().CustomerID)}
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.RecordTime)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.UserID)
        </td>
        <td>
            @Html.ActionLink("详细", "Details", new { id=item.ProjectID })
        </td>
        <td>
            @if (User.Identity.Name == item.UserID)
            {@Html.ActionLink("增加产品信息", "Create", "ProductType", new { projectID = item.ProjectID }, null);
            }
        </td>
        <td>
            @if (User.Identity.Name == item.UserID)
            {
            @Html.ActionLink("编辑", "Edit", new { id = item.ProjectID }); <text>|</text>
            @Html.ActionLink("删除", "Delete", new { id = item.ProjectID });
            }
        </td>
        <td>
            @if (User.Identity.Name == "10307" || User.Identity.Name =="邬婕鸣")
            {
            @Html.ActionLink("项目完结确认", "SetClose", new { id = item.ProjectID });
            }
        </td>
    </tr>
}

</table>
 @Html.Pager(Model, new PagerOptions { PageIndexParameterName = "id" })